Imports System.Windows.Forms
Imports Vintasoft.Pdf
Imports DemosCommonCode.Imaging

Namespace Pdf
	Public Partial Class ImageResourceCompressionParamsForm
		Inherits Form

		#Region "Constructor"

		Public Sub New()
			InitializeComponent()
			compressionComboBox.Items.Add(PdfCompression.Auto)
			compressionComboBox.Items.Add(PdfCompression.Jpeg)
			compressionComboBox.Items.Add(PdfCompression.Zip)
			compressionComboBox.Items.Add(PdfCompression.CcittFax)
			compressionComboBox.Items.Add(PdfCompression.Jbig2)
			compressionComboBox.Items.Add(PdfCompression.Lzw)
			compressionComboBox.Items.Add(PdfCompression.RunLength)
			compressionComboBox.SelectedIndex = 0
		End Sub

		#End Region



		#Region "Properties"

		Private _compression As PdfCompression = PdfCompression.Auto
		Public ReadOnly Property Compression() As PdfCompression
			Get
				Return _compression
			End Get
		End Property

		Private _settings As PdfCompressionSettings = Nothing
		Public ReadOnly Property CompressionSettings() As PdfCompressionSettings
			Get
				Return _settings
			End Get
		End Property

		#End Region



		#Region "Methods"


		Private Sub buttonOk_Click(sender As Object, e As EventArgs)
			_compression = DirectCast(compressionComboBox.SelectedItem, PdfCompression)
			If _settings Is Nothing Then
				_settings = PdfCompressionSettings.DefaultSettings
			End If
			DialogResult = DialogResult.OK
		End Sub

		Private Sub compressionParamsbuttonB_Click(sender As Object, e As EventArgs)
			_settings = New PdfCompressionSettings()
			Dim propertyGridForm As New PropertyGridForm(_settings, "Compression Settings")
			propertyGridForm.ShowDialog()
		End Sub

		#End Region

	End Class
End Namespace
